<?php
//初始化奖池
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

$where = [
    'data_status' => 1,
    'stock[>]' => 0,
];

$prizes = \Biz\model\MijiaSmartKitchen\MiJiaSmartKitchenPrize::dataSelect($where,['id','goods_name','stock']);


$prizeArr = [];

foreach ($prizes as $prize){
    for($count = 0; $count < $prize['stock'];$count++){
        $prizeArr[] = ['prize_id'=>$prize['id'],'prize_name'=>$prize['goods_name']];
    }
}

\Biz\cache\lottery\MijiaSmartKitchenLottery::emptyPrizePool();

\Biz\cache\lottery\MijiaSmartKitchenLottery::setPrizePool($prizeArr);


